home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Temático 40 Febrero 2004.iso / DOS / ntfs / dos / common.h next >
Encoding:
C/C++ Source or Header  |  2001-02-11  |  4.0 KB  |  175 lines

  1. /*
  2.  
  3.     File: common.h
  4.  
  5.     Copyright (C) 1998-2001  Christophe Grenier <grenier@nef.esiea.fr>
  6.   
  7.     This software is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation; either version 2 of the License, or
  10.     (at your option) any later version.
  11.   
  12.     This program is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.   
  17.     You should have received a copy of the GNU General Public License
  18.     along with this program; if not, write to the Free Software
  19.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  */
  22. #define SECTOR_SIZE     0x200
  23.  
  24. #define MAX_CYLINDERS 65535
  25. #define MAX_HEADS 255
  26. #define MAX_SECTORS 63
  27.  
  28.  
  29. #define NBR_PART_MAX    40
  30. #define NBR_DISK_MAX    20
  31. #define TAB_PART 0x1BE
  32. /* PARTITION TYPE */
  33. #define P_NO_OS         0x00
  34. #define P_12FAT         0x01
  35. #define P_16FAT         0x04
  36. #define P_EXTENDED      0x05
  37. #define P_16FATBD       0x06
  38. #define P_NTFS          0x07
  39. #define P_HPFS          0x07
  40. #define P_OS2MB         0x0A
  41. #define P_32FAT_1       0x0B
  42. #define P_32FAT_2       0x0C
  43. #define P_EXTENDX       0x0F
  44. #define P_16FATH        0x14
  45. #define P_16FATBDH      0x16
  46. #define P_NTFSH         0x17
  47. #define P_32FAT_1H      0x1B
  48. #define P_32FAT_2H      0x1C
  49. #define P_NETWARE        0x65
  50. #define P_OLDLINUX      0x81
  51. #define P_LINSWAP       0x82
  52. #define P_LINSWAP2      0x82
  53. #define P_LINUX         0x83
  54. #define P_BSD           0xA5
  55. #define P_BEOS          0xEB
  56. enum { STATUS_DELETED, STATUS_PRIM, STATUS_PRIM_BOOT, STATUS_LOG, STATUS_EXT, STATUS_EXT_IN_EXT};
  57. enum {BAD_SS, BAD_ES, BAD_SH, BAD_EH, BAD_EBS, BAD_RS, BAD_SC, BAD_EC,
  58.   BAD_SCOUNT};
  59. int doprintf(const char *, ...);
  60. int ecrit_rapport(const char *, ...);
  61. void ecrit_rapport_string(const char *string,const int max_length);
  62.  
  63. typedef struct cellule_disk_param *t_param_disk;
  64. typedef const struct cellule_disk_param *t_param_disk_cst;
  65.  
  66. typedef struct cellule_disk *t_disk;
  67. typedef const uchar t_sector_cst[0x200];
  68. typedef uchar t_sector[0x200];
  69. typedef uchar t_entree[0x10];
  70. typedef const uchar t_entree_cst[0x10];
  71. typedef const struct cellule_disk *t_disk_cst;
  72. typedef struct cellule_diskext *t_diskext;
  73. typedef struct cellule_diskext2 *t_diskext2;
  74. typedef const struct cellule_diskext *t_diskext_cst;
  75. typedef struct cellule_CHS t_CHS;
  76.  
  77. struct cellule_CHS
  78. {
  79.   uint cylinder;
  80.   uint head;
  81.   uint sector;
  82. };
  83.  
  84. typedef struct cellule_list_part * t_list_part;
  85. struct cellule_list_part
  86. {
  87.   t_diskext part;
  88.   t_list_part prev;
  89.   t_list_part next;
  90. };
  91.  
  92. struct cellule_disk_param
  93.  {
  94.   int disk;
  95.   t_CHS CHS;
  96. #ifdef DJGPP
  97.   int mode;
  98. #else
  99.   char *name;
  100. #endif
  101.  };
  102.  
  103. struct cellule_disk
  104.  {
  105.   byte disk;
  106.   uint cylinder;
  107.   uint head;
  108.   uint sector;
  109.  };
  110.  
  111.  
  112. struct cellule_diskext
  113.  {
  114.   uint disk;
  115.   t_CHS start;
  116.   t_CHS end;
  117.   uchar part_type;
  118.   dword part_size;
  119.   dword sect_rel;
  120.   uint status;
  121.   uint order;
  122.   uint errcode;
  123.  };
  124.  
  125.  
  126. struct cellule_diskext2
  127.  {
  128.   uint disk;
  129.   t_CHS start;
  130.   t_CHS end;
  131.   uchar part_type;
  132.   dword part_size;
  133.   dword sect_rel;
  134.   uint status;
  135.   uint order;
  136.  };
  137.  
  138. typedef struct cellule_param t_param;
  139. struct cellule_param
  140. {
  141.   word size;
  142.   word info;
  143.   dword cyl;
  144.   byte head;
  145.   byte sect;
  146.   dword nbrsect1;
  147.   dword nbrsect2;
  148.   word  bps;
  149. };
  150.  
  151. typedef struct str_fat t_fat_test;
  152. struct str_fat
  153. {
  154.   dword offset;
  155.   int f_fat12;
  156.   int f_fat16;
  157.   int f_fat32;
  158. };
  159.  
  160. void dup_t_disk(t_disk, t_disk_cst);
  161. void dup_t_diskext(t_diskext, t_diskext_cst);
  162. int hd_identify(t_param_disk,int debug);
  163. int ask_YN(const char*);
  164. int ask_number(const char*, const int,const int);
  165. int read_line(void);
  166. char read_char(const char *);
  167. void *MALLOC(size_t size);
  168. void FREE(void *ptr);
  169. char read_key(void);
  170. char test_key(void);
  171. uint up2power(uint number);
  172. uint up2power_aux(uint number);
  173. int hd_parse(t_param_disk param_disk[NBR_DISK_MAX],const int debug);
  174. void my_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
  175.